<script setup>
import {ref} from "vue";
import request  from '@/api/request'
let emits=defineEmits(["ref-table"])
let onSubmit=()=>{
            emits("ref-table")
}
const handleChange2 = (value=number) => {
  console.log(value)
}
let num2 = ref(0.1)

const value1 = ref(true)
const radio1 = ref('1')
const radio2 = ref('1')
let zhuangtai=ref(false);
let MaterialManagement=ref({})
</script>
<template>
    <div>
        <el-card>
            <template #header>
                <el-form :model="MaterialManagement" ref="form" :rules="rules" label-width="80px" :inline="false" size="normal" class="card_wrap">
                    <el-form-item label="" class="c_item">
                        
                            单位编码
                            <el-input v-model="MaterialManagement.Material_id" style="width: 800px;"></el-input> 
                    </el-form-item>
                    <el-form-item label="" class="c_item">
                           单位名称
                            <el-input v-model="MaterialManagement.Material_name" style="width: 800px"></el-input>
                             </el-form-item>
                            <el-form-item label="" class="c_item">
                                是否为主单位
                                <el-radio-group v-model="radio2">
                                <el-radio value="1" size="large">是</el-radio>
                                <el-radio value="2" size="large">否</el-radio>
                                </el-radio-group>
                            </el-form-item>
                            <el-form-item v-if="radio2==2" label="" class="c_item_big">
                                主单位
                                <el-select placeholder="选择单位" v-model="MaterialManagement.Category" style="width: 150px;">
                                    <el-option value="wl" label="箱"></el-option>
                                    <el-option value="cp" label="盒"></el-option>
                            </el-select>
                            </el-form-item>
                        <el-form-item v-if="radio2==2" label="" class="c_item_big">
                                换算比例    
                            <el-input-number v-model="num2" :min="0" :max="100" @change="handleChange2"/>
                        </el-form-item>
                            <el-form-item label="" class="c_item">
                                是否启用
                                <el-radio-group v-model="radio1">
                                <el-radio value="1" size="large">是</el-radio>
                                <el-radio value="2" size="large">否</el-radio>
                                </el-radio-group>
                            </el-form-item>
                            <el-form-item label="" class="c_item_big">
                            备注
                            <el-input v-model="MaterialManagement.SpecificationsAndModels" placeholder="请输入内容" style="width: 800px;height: 60px;"></el-input>
                            </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">确定修改</el-button>
                    </el-form-item>
                </el-form>
            </template>
        </el-card>
        <router-view/>
    </div>
</template>
<style scoped>
.c_item {
    flex: 1;
    margin: 0px 5px 15px 0;
    width: calc((100%-10px)/1);
    min-width: calc((100% - 10px)/1);
    max-width: calc((100% - 10px)/1);

    &:nth-child(3n) {
        margin-right: 0;
    }
}
.c_item_big {
    flex: 2;
    margin: 0px 5px 15px 0;
    width: calc((100%-10px)/1);
    min-width: calc((100% - 10px)/1);
    max-width: calc((100% - 10px)/1);

    &:nth-child(3n) {
        margin-right: 0;
    }
}
.card_wrap {
    width: 98%;
    
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}
</style>